import React from 'react'
import styles from './App.module.css'

import PropTypes from 'prop-types'

// 函数式子组件
export const FSon = (props: any) => {
  console.log('函数组件', props)
  const { colors: arr } = props
  const lis = arr.map((item: any, index: any) => (
    <li key={index}>{item.name}</li>
  ))
  return (
    <div className={styles.two}>
      <div>函数子组件：</div>
      <ul>{lis}</ul>
    </div>
  )
}
FSon.propTypes = {
  colors: PropTypes.array,
}
